﻿using Quartz;

namespace YunQue.Core.Common.QuartzManager
{
    /// <summary>
    /// job信息
    /// </summary>
    public class JobInfo
    {
        /// <summary>
        /// job是否存在
        /// </summary>
        public bool IsExists { get; set; }
        /// <summary>
        /// 是否在运行中
        /// </summary>
        public bool IsRunning { get; set; }
        /// <summary>
        /// job名称
        /// </summary>
        public string JobName { get; set; }
        /// <summary>
        /// 最近一次运行时间
        /// </summary>
        public DateTime LastRunTime { get; set; }
        /// <summary>
        /// 下一次运行时间
        /// </summary>
        public DateTime NextRunTime { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public TriggerState Status { get; set; }
        /// <summary>
        /// 状态描述
        /// </summary>
        public string StatusDescription
        {
            get
            {
                switch (Status)
                {
                    case TriggerState.None:
                        return "不存在";
                    case TriggerState.Normal:
                        return "正常";
                    case TriggerState.Paused:
                        return "已暂停";
                    case TriggerState.Complete:
                        return "已完成";
                    case TriggerState.Error:
                        return "错误";
                    case TriggerState.Blocked:
                        return "阻塞";
                    default: return "";
                }
            }
        }
    }
}
